const path = require("path");

/**
 * 是否可以进行文件夹的eslint检测
 * @param {*} context 
 * @returns boolean
 */
function canDirectoryLint(context) {
  const flagFilenName = "eslint.config.js";

  const filename = context.getFilename();
  const cwd = context.getCwd();

  const flagFilePath = path.resolve(cwd, flagFilenName); //卯点文件，eslint只能检查文件，通过eslint.config.js文件触发检测一次文件夹

  return flagFilePath === filename;
}

module.exports = {
  canDirectoryLint,
};
